<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('工地安全')" />
    <link rel="stylesheet" href="../../../../../../../../../../../../css/navigation.css">
</head>
<body class="gray-bg">
<div class="navigation visible-xs-block">
    <ol class="breadcrumb">
        <span> > </span>
        <li><a href="#" onclick="gomain()">主页</a></li>
        <li style="color: black">工地安全质量</li>
    </ol>
    <div class="aLine"></div>
</div>
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>
                        <li hidden>
                            <label>创建者：</label>
                            <input type="text" name="pFounder"/>
                        </li>
<!--                        <li hidden>-->
<!--                            <label>建筑名称：</label>-->
<!--                            <input type="text" name="pName"/>-->
<!--                        </li>-->
<!--                        <li class="select-time">-->
<!--                            <label>创建时间：</label>-->
<!--                            <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginPTime]"/>-->
<!--                            <span>-</span>-->
<!--                            <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endPTime]"/>-->
<!--                        </li>-->
                        <li hidden>
                            <label>建筑地址：</label>
                            <input type="text" name="pAddress"/>
                        </li>
                        <li hidden>
                            <label>建筑面积：</label>
                            <input type="text" name="pArea"/>
                        </li>
                        <li hidden>
                            <label>使用点位联系人：</label>
                            <input type="text" name="pUnitContact"/>
                        </li>
                        <li hidden>
                            <label>联系电话：</label>
                            <input type="text" name="pTelephone"/>
                        </li>
                        <li hidden>
                            <label>项目状态：</label>
                            <input type="text" name="pState"/>
                        </li>

<!--                        查询父表建筑名 和创建时间-->
                        <li>
                            <label>建筑名称：</label>
                            <input type="text" name="pName"/>
                        </li>
                        <li class="select-time">
                            <label>创建时间：</label>
                            <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginPTime]"/>
                            <span>-</span>
                            <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endPTime]"/>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>
        <div class="btn-group-sm" id="toolbar" role="group">
            <!--                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:salary:add">-->
            <!--                    <i class="fa fa-plus"></i> 添加-->
            <!--                </a>-->
            <!--                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:salary:edit">-->
            <!--                    <i class="fa fa-edit"></i> 修改-->
            <!--                </a>-->
            <!--                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:salary:remove">-->
            <!--                    <i class="fa fa-remove"></i> 删除-->
            <!--                </a>-->
            <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="ruoyi:constructionCost:exports">
                <i class="fa fa-download"></i> 导出
            </a>
        </div>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer" />
<script src="../../../../../../../../../../../../js/breadcrumb.js"></script>
<script th:inline="javascript">

    var editFlag = [[${@permission.hasPermi('system:building:edit')}]];
    var removeFlag = [[${@permission.hasPermi('ruoyi:schedule:remove')}]];
    var creadFlag = [[${@permission.hasPermi('ruoyi:schedule:add')}]];
    var prefix = ctx + "system/building";
    var prefixs =ctx + "ruoyi/schedule";
    var datas = [[${@dict.getType('sys_normal_disable')}]];
    var mStatus = [[${@dict.getType('z_project_status')}]];
    $(function() {
        var options = {
            url: prefix + "/list",
            createUrl: prefixs + "/add/{id}",
            updateUrl: prefixs + "/edit/{id}",
            removeUrl: prefixs + "/remove",
            exportUrl: prefixs + "/exports",
            modalName: "创建项目",
            showColumns: false,
            detailView: true,
            mobileResponsive: false,
            cardView: true,
            onExpandRow : function(index, row, $detail) {
                initChildTable(index, row, $detail);
            },
            columns: [
                {
                    field: 'pId',
                    title: '项目id',
                    visible: false
                },
                // {
                //     field: 'pFounder',
                //     title: '创建者'
                // },
                {
                    field: 'pName',
                    title: '建筑名称',

                },
                {
                    field: 'pTime',
                    title: '创建时间',

                },

                {
                    field: 'pState',
                    title: '项目状态',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(mStatus, value);
                    }

                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success ' + creadFlag + '" href="javascript:void(0)" onclick="$.operate.add(\'' + row.pId + '\')"><i class="fa fa-add"></i>添加</a> ');
                        return actions.join('');
                    }
                }
                ]
        };
        $.table.init(options);
    });

    initChildTable = function(index, row, $detail) {
        var childTable = $detail.html('<table style="table-layout:fixed"></table>').find('table');

        var editFlag = [[${@permission.hasPermi('ruoyi:schedule:edit')}]];
        var removeFlag = [[${@permission.hasPermi('ruoyi:schedule:remove')}]];
        $(childTable).bootstrapTable({
            url: prefixs + "/lists",
            modalName: "工地安全质量费用",
            method: 'post',
            sidePagination: "server",
            contentType: "application/x-www-form-urlencoded",
            queryParams: {
                sid:row.pId
            },
            columns: [{
                field: 'sId',
                title: '工地安全质量id',
                visible: false
            },
                {
                    field: 'sFeeName',
                    title: '费用名称'
                },
                {
                    field: 'sFeeMoney',
                    title: '费用金额'
                },
                {
                    field: 'sUploading',
                    title: '上传图片',
                    formatter: function(value, row, index) {
                        return '<a href="javascript:downloadFile(\''+row.sUploading+'\')">下载</a>';
                    }
                },
                {
                    field: 'sRemark',
                    title: '备注'
                },
                {
                    field: 'sTheHeir',
                    title: '上传人'
                },
                {
                    field: 'sTime',
                    title: '上传时间'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.sId + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
        });
    };
    function downloadFile(pUploading) {
        window.location.href=ctx+"common/download/resource?resource="+pUploading;
    }
</script>
</body>
</html>